
<!DOCTYPE html>
<html lang="en-us">
<head>
  
  <meta charset="UTF-8" />
  <meta name="description" content="WiringPi是一个用C语言编写的、基于PIN的GPIO访问库。提供了GPIO、I2C、SPI、UART和PWM等库，对于树莓派的GPIO编程相当方便。" />
  <title>
    树莓派4B-WiringPi库 | DenysG的个人博客
  </title>
  
  <meta name="viewport" content="width=device-width,user-scalable=no,maximum-scale=1,initial-scale=1">
  
  <link rel="canonical" href="https://48474.net/post/raspi-wiringpi/"/>
  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">
  
  <link rel="stylesheet" href="/css/sanitize.css">
  <link rel="stylesheet" href="/css/responsive.css">
  <link rel="stylesheet" href="/css/highlight_monokai.css">
  <link rel="stylesheet" href="/css/theme.css">
  <link rel="stylesheet" href="/css/custom.css">
  
  
  <link href="https://48474.net//index.xml" rel="alternate" type="application/rss+xml" title="DenysG的个人博客" />
  <link href="https://48474.net//index.xml" rel="feed" type="application/rss+xml" title="DenysG的个人博客" />

  
  

</head>



<body>
<div class="container">
  
  <header role="banner">
    <div class="row gutters">
      <div id="site-title" class="col span_6">
        <h1><a href="https://48474.net/">DenysG的个人博客</a></h1>
        <h2>我必须承认，幸运喜欢照顾勇敢的人。---- 达尔文</h2>
      </div>
      <div id="social" class="col span_6">
        <ul>
          
          
          <li><a href="https://github.com/cnphpbb/" target="_blank">GitHub</a></li>
          
        </ul>
      </div>
    </div>
  </header>


  
  <main id="single" role="main">
    <div class="article-header">
      <h1>树莓派4B-WiringPi库</h1>
      <div class="meta">
        Nov 6, 2022 &nbsp;
        
          #<a href="/tags/raspi">RasPi</a>&nbsp;
        
          #<a href="/tags/guide">guide</a>&nbsp;
        
          #<a href="/tags/wiringpi">wiringPi</a>&nbsp;
        
          #<a href="/tags/i2c">I2C</a>&nbsp;
        
          #<a href="/tags/gpio">gpio </a>&nbsp;
        
          #<a href="/tags/%E5%BC%80%E6%BA%90">开源</a>&nbsp;
        
          #<a href="/tags/guide">guide</a>&nbsp;
        
          #<a href="/tags/raspberrypi">raspberrypi</a>&nbsp;
        
      </div>
    </div>
    <article>
      <h2 id="wiringpi">WiringPi</h2>
<h3 id="官网">官网</h3>
<p><a href="http://wiringpi.com/">wiringpi.com</a></p>
<h3 id="github-wiringpi">GitHub WiringPi</h3>
<p><a href="https://github.com/WiringPi">github.com/WiringPi</a></p>
<p>目前 <a href="https://github.com/WiringPi">https://github.com/WiringPi</a> 仓库支持的版本有</p>
<ul>
<li>C/C++</li>
<li>Python</li>
<li>PHP</li>
<li>Node</li>
<li>Ruby</li>
<li>Perl</li>
</ul>
<h3 id="wiringpi-go">WiringPi-Go</h3>
<p><a href="https://github.com/CarlosRA97/wpi">WiringPi-Go</a></p>
<p>Golang wrapped version of Gordon&rsquo;s Arduino-like WiringPi for the Raspberry Pi</p>
<h3 id="wiringpi库简介">WiringPi库简介</h3>
<p>WiringPi是一个用C语言编写的、基于PIN的GPIO访问库，提供了GPIO、I2C、SPI、UART和PWM等库，对于树莓派的GPIO编程相当方便。目前可在基于BCM2835、BCM2836和BCM2837的树莓派中使用。其他详细介绍请参看wiringPi官网介绍。</p>
<h4 id="wiringpi-c-安装">WiringPi-C 安装</h4>
<p>截止文章发布日（2022-11-06） WiringPi  Releases Version 2.61-1<br>
<a href="https://github.com/WiringPi/WiringPi/releases/tag/2.61-1">https://github.com/WiringPi/WiringPi/releases/tag/2.61-1</a></p>
<p>方法1:  <strong>deb方式</strong></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl"><span class="nb">cd</span> ~/work
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1">## 请按系统选择格式的deb包。本人系统为 64位 版本。</span>
</span></span><span class="line"><span class="cl">wget  https://github.com/WiringPi/WiringPi/releases/download/2.61-1/wiringpi-2.61-1-arm64.deb
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">dpkg -i wiringpi-2.61-1-arm64.deb
</span></span></code></pre></div><p>方法2:  <strong>源码方式</strong></p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl"><span class="nb">cd</span> ~/work
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">wget -O wiringpi-2.61-1.tar.gz  https://github.com/WiringPi/WiringPi/archive/refs/tags/2.61-1.tar.gz
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">tar zxfv  wiringpi-2.61-1.tar.gz 
</span></span><span class="line"><span class="cl"><span class="nb">cd</span> wiringpi-2.61-1
</span></span><span class="line"><span class="cl">./build
</span></span></code></pre></div><p>安装成功后，输入命令：gpio -v，可以查看WiringPi的版本</p>
<p><img src="https://hks3.7y2.org/myimg02/images/202211062303847.png" alt="gpio -v"></p>
<p>其他开放的 <code>command</code>  <code>gpio -h</code></p>
<p><img src="https://hks3.7y2.org/myimg02/images/202211062308664.png" alt="command"></p>
<p>对接后的OLED显示器，SSD1306 驱动</p>
<p><img src="https://hks3.7y2.org/myimg02/images/202211062340040.png" alt=""></p>

      
      
      
    </article>
    


  </main>
  
  <nav class="pagination-single">
    
      <span class="previous">&larr; <a href="https://48474.net/post/jest-guide/" rel="prev">今天学到了 Jest 单元测试</a></span>
    
    
      <span class="next"><a href="https://48474.net/post/raspi-install_raspi-firmware/" rel="next">树莓派4B-安装raspi-firmware</a> &rarr;</span>
    
  </nav>


  
  <footer role="contentinfo">
    <div style="text-align:center;">
      
      © 2020 135Get_Team. All rights reserved.
    </div>
  </footer>


</div>

<script src="/js/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>



</body>
</html>

